home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / Lex.cpt / Lex / STDIO_LEXLIB.π folder / LMOVB_DEBUG.C < prev    next >
Text File  |  1990-06-19  |  2KB  |  57 lines

  1. /*
  2.   HEADER: CUG    nnn.nn;
  3.   TITLE:    LEX - A Lexical Analyser Generator
  4.   VERSION:       1.0 for IBM-PC
  5.   DATE:    Jan 30, 1985
  6.   DESCRIPTION:   A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:      Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:    IBM-PC and Compatiables
  9.   FILENAME:      LMOVB.C
  10.   WARNINGS:      This program is not for the casual user. It will
  11.     be useful primarily to expert developers.
  12.   CRC:    N/A
  13.   SEE-ALSO:      YACC and PREP
  14.   AUTHORS:       Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:    UNIX Systems Manuals
  17. */
  18. /*
  19.  * Bob Denny     28-Aug-82  Remove reference to stdio.h
  20.  * Scott Guthery 20-Nov-83  Adapt for IBM PC & DeSmet C
  21.  */
  22.  
  23. #include    <stdio.h>
  24. #include    <ctype.h>
  25. #include    "lex.h"
  26.  
  27. SHORTINT
  28. _lmovb_debug(ltab_ptr, the_char, state)
  29. register struct lextab *ltab_ptr;
  30. register SHORTINT the_char, state;
  31. {
  32.     SHORTINT base, temp;
  33.     printf((char *)"\nState %d, char %c [%3d] ",
  34.         state, isprint(the_char) ? the_char : '*', the_char);
  35.  
  36.     while (    (base = ltab_ptr->llbase[state]+the_char) > ltab_ptr->llnxtmax ||
  37.             (ltab_ptr->llcheck[base] & 0377) != state) {
  38.         if (state != ltab_ptr->llendst)
  39.             {
  40.             /*
  41.              * This miscompiled on Decus C many years ago:
  42.              *    state = ltab_ptr->lldefault[state] & 0377;
  43.              */
  44.             temp = ltab_ptr->lldefault[state] & 0377;
  45.             state = temp;
  46.             }
  47.         else {
  48.             printf((char *)"base %d ", base - the_char);
  49.             printf((char *)"--> goto final");
  50.             return(-1);
  51.             }
  52.         }
  53.     printf((char *)"base %d ", base - the_char);
  54.     printf((char *)"--> goto %d", ltab_ptr->llnext[base] & 0377);
  55.     return(ltab_ptr->llnext[base] & 0377);
  56.     }
  57.